
import actions from '../action/login';
import CONSTANT from '../constant/login';

const loginObj = {};

export default {
  actions,
  state: {
    loginObj,
  },
  mutations: {
    [CONSTANT.LOGIN_SUCCESS](state, data) {
      state.loginObj = data;
    },
    [CONSTANT.SET_PASSWORD_SUCCESS](state) {
      state.loginObj.isFirstLogin = !state.loginObj.isFirstLogin;
    },
    [CONSTANT.GET_LOGIN_INFO](state, data) {
      state.loginObj = data;
    },
    [CONSTANT.SET_LOGIN_INFO](state, info) {
      state.loginObj = info;
    },
  },
  getters: {
    [CONSTANT.LOGIN_STATUS](state) {
      return state.loginObj;
    },
    [CONSTANT.PASSWORD](state) {
      return state.loginObj.isFirstLogin;
    },
  },
};
